package dfs;

/**
 * @author 帅小伙
 * @date 2022/1/1
 * @description
 */
public class Demo03JZ82二叉树中和为某一值的路径 {

    public boolean hasPathSum(Demo02ZJ79是否是平衡二叉树.TreeNode root, int sum) {
        if (root == null)
            return false;


        if (sum == 0 && root.left == null && root.right == null)
            return true;

        return hasPathSum(root.left, sum) || hasPathSum(root.right, sum);
    }
}
